Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | 3x 3x 3x 3x 3x 1x 2x 3x 3x 3x 3x 3x 2x 2x 2x 3x 3x 1x 2x 2x 1x 1x 1x 1x 3x 3x 3x 1x 2x | import { fetchProjectBySlug } from "@/data/loaders";
import { notFound } from "next/navigation";
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "@/components/ui/accordion";
import { Button } from "@/components/ui/button";
import { FaGitAlt, FaExternalLinkAlt } from "react-icons/fa";
import { FaArrowLeftLong } from "react-icons/fa6";
import { Badge } from "@/components/ui/badge";
import Link from "next/link";
import { Metadata } from "next";
import RenderMarkdown from "@/components/custom/RenderMarkdown";
import { generateMetadataObject } from '@/lib/metadata';
import fetchContentType from '@/lib/strapi/fetchContentType';
import { strapiImage } from '@/lib/strapi/strapiImage';
import { extractTextFromRichText } from "@/lib/utils";
import Image from "next/image";
interface PageProps {
params: Promise<{ slug: string }>;
}
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
const BASE_URL_NEXT = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000";
const resolveParams = await params;
const slug = await resolveParams?.slug;
const pageData = await fetchContentType('projects', {
filters: { slug: slug },
populate: ["category", "seo.metaImage", "image"],
}, true)
if (!pageData) {
return {
title: "Project Not Found | Bitmutex Technologies",
description: "The requested project does not exist. Browse more projects by Bitmutex Technologies.",
robots: "noindex, nofollow",
};
}
const seo = pageData?.seo;
const metadata = generateMetadataObject(seo);
const richTextString = extractTextFromRichText(pageData.description);
const seotitle = seo?.metaTitle
? `${seo.metaTitle} | ${pageData.category?.text || "Uncategorized"} | Bitmutex Projects`
: `${pageData.name || "Untitled"} | ${pageData.category?.text || "Uncategorized"} | Bitmutex Projects`;
let seodescription = seo?.metaDescription || richTextString || "";
Iif (seodescription.length > 150) {
seodescription = seodescription.substring(0, seodescription.lastIndexOf(" ", 150)) + "...";
}
metadata.title = seotitle;
metadata.description = seodescription;
metadata.openGraph = {
...(metadata.openGraph as any),
title: seotitle,
description: seodescription,
images: seo?.metaImage
? [{ url: strapiImage(seo?.metaImage.url) }]
: pageData?.image
? [{ url: strapiImage(pageData.image.url) }]
: [],
url: `${BASE_URL_NEXT}/projects/${slug}`,
site_name: "Bitmutex",
locale: "en_US",
type: "article",
};
metadata.alternates = {
canonical: `${BASE_URL_NEXT}/projects/${slug}`,
};
return metadata;
}
const renderRichText = (content: any) => {
Iif (!content) return null;
if (Array.isArray(content)) {
return content.map((block, index) => {
Eif (block.type === "paragraph") {
return <p key={index} className="mb-3 leading-relaxed">{block.children.map((child: any) => child.text).join(" ")}</p>;
}
return null;
});
}
return <p className="leading-relaxed">{content}</p>;
};
export default async function ProjectDetailPage({ params }: PageProps) {
const { slug } = await params;
const project = await fetchProjectBySlug(slug);
if (!project) {
return notFound();
}
return (
<div className="min-h-screen bg-linear-to-br from-slate-50 via-white to-blue-50 dark:from-slate-950 dark:via-slate-900 dark:to-slate-800">
{/* Hero Section with Gradient Background */}
<div className="relative overflow-hidden">
<div className="absolute inset-0 bg-linear-to-r from-blue-600/10 via-purple-600/10 to-cyan-600/10 dark:from-blue-500/20 dark:via-purple-500/20 dark:to-cyan-500/20"></div>
<div className="relative container mx-auto px-6 pt-24 pb-12">
{/* Navigation */}
<div className="mb-8">
<Link href="/projects">
<Button
variant="ghost"
className="group hover:bg-white/80 dark:hover:bg-slate-800/80 backdrop-blur-sm border border-white/20 dark:border-slate-700/30 transition-all duration-300 hover:scale-105 hover:shadow-lg"
>
<FaArrowLeftLong className="mr-2 h-4 w-4 transition-transform group-hover:-translate-x-1" />
Back to Projects
</Button>
</Link>
</div>
{/* Project Header */}
<div className="mb-12">
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-6">
<div>
<h1 className="font-heading text-4xl py-1 md:text-5xl font-bold bg-linear-to-r from-slate-900 via-blue-900 to-slate-900 dark:from-white dark:via-blue-100 dark:to-white bg-clip-text text-transparent leading-tight">
{project.name}
</h1>
{project.category && (
<div className="mt-4">
<Badge
variant="default"
className="font-sans px-3 py-2 rounded-full text-xs font-medium bg-linear-to-r from-blue-500 to-sky-600 text-white border-0 hover:from-blue-600 hover:to-sky-700 transition-all duration-300 hover:scale-105 hover:shadow-lg"
>
{project.category}
</Badge>
</div>
)}
</div>
{/* Action Buttons */}
<div className="flex flex-wrap gap-3">
{project.repourl && (
<Button
asChild
variant="outline"
className="group bg-white/80 dark:bg-slate-800/80 backdrop-blur-sm border-slate-200 dark:border-slate-700 hover:bg-white dark:hover:bg-slate-800 hover:scale-105 hover:shadow-lg transition-all duration-300"
>
<a href={project.repourl} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
<FaGitAlt className="h-4 w-4 group-hover:rotate-12 transition-transform" />
Repository
</a>
</Button>
)}
{project.hostedurl && (
<Button
asChild
className="group bg-linear-to-r from-blue-600 to-sky-600 hover:from-blue-700 hover:to-sky-700 text-white border-0 hover:scale-105 hover:shadow-lg transition-all duration-300"
>
<a href={project.hostedurl} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2">
<FaExternalLinkAlt className="h-4 w-4 group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform" />
Live Demo
</a>
</Button>
)}
</div>
</div>
</div>
</div>
</div>
{/* Main Content */}
<div className="container mx-auto px-6 pb-16">
<div className="grid lg:grid-cols-3 gap-12">
{/* Project Image */}
{project.imageUrl && (
<div className="lg:col-span-2">
<div className="relative group overflow-hidden rounded-2xl bg-white dark:bg-slate-800 p-2 shadow-xl hover:shadow-2xl transition-all duration-500">
<div className="absolute inset-0 bg-linear-to-r from-blue-500/10 to-purple-500/10 rounded-2xl"></div>
<Image
src={project.imageUrl}
alt={project.name}
width={800}
height={600}
className="relative w-full max-w-5xl h-96 min-h-40 object-contain rounded-xl group-hover:scale-[1.02] transition-transform duration-700"
/>
</div>
</div>
)}
{/* Project Description */}
<div className={`${project.imageUrl ? 'lg:col-span-1' : 'lg:col-span-3'}`}>
<div className="bg-white/80 dark:bg-slate-800/80 backdrop-blur-sm rounded-2xl p-8 shadow-xl border border-white/20 dark:border-slate-700/30 hover:shadow-2xl transition-all duration-500">
<h2 className="font-heading text-2xl font-bold mb-6 text-slate-900 dark:text-white">
Project Overview
</h2>
<div className="font-sans text-slate-700 dark:text-slate-300 text-lg leading-relaxed space-y-4">
{renderRichText(project.description)}
</div>
</div>
</div>
</div>
{/* Project Details Section */}
<div className="mt-16">
<div className="bg-white/80 dark:bg-slate-800/80 backdrop-blur-sm rounded-2xl shadow-xl border border-white/20 dark:border-slate-700/30 overflow-hidden hover:shadow-2xl transition-all duration-500">
<Accordion type="single" defaultValue="details" collapsible className="w-full">
<AccordionItem value="details" className="border-none">
<AccordionTrigger className="px-8 py-6 text-xl font-semibold text-slate-900 dark:text-white hover:bg-slate-50/50 dark:hover:bg-slate-700/30 transition-colors duration-300 data-[state=open]:bg-slate-50/50 dark:data-[state=open]:bg-slate-700/30">
<div className="flex items-center gap-3 font-heading">
<div className="w-2 h-2 rounded-full bg-linear-to-r from-blue-500 to-purple-500"></div>
Technical Details & Implementation
</div>
</AccordionTrigger>
<AccordionContent className="px-8 pb-8">
<div className="pt-4 border-t border-slate-200/50 dark:border-slate-700/50">
<div className="prose prose-slate dark:prose-invert max-w-none prose-lg">
<RenderMarkdown content={project.details} />
</div>
</div>
</AccordionContent>
</AccordionItem>
</Accordion>
</div>
</div>
{/* Enhanced Call-to-Action Section */}
{(project.repourl || project.hostedurl) && (
<div className="mt-16">
<div className="bg-linear-to-r from-blue-600 via-sky-500 to-cyan-600 rounded-2xl p-1 shadow-xl hover:shadow-2xl transition-all duration-500">
<div className="bg-white dark:bg-slate-900 rounded-[calc(1rem-2px)] p-8 text-center">
<h3 className="font-heading text-2xl font-bold mb-4 bg-linear-to-r from-blue-600 to-sky-600 bg-clip-text text-transparent">
Ready to Explore?
</h3>
<p className="font-sans text-slate-600 dark:text-slate-400 mb-6 text-lg">
Check out the live demo or dive into the source code to see how it's built.
</p>
<div className="flex flex-wrap justify-center gap-4">
{project.hostedurl && (
<Button
asChild
size="lg"
className="group bg-linear-to-r from-blue-600 to-sky-600 hover:from-blue-700 hover:to-sky-700 text-white border-0 hover:scale-105 hover:shadow-lg transition-all duration-300 px-8 py-3"
>
<a href={project.hostedurl} target="_blank" rel="noopener noreferrer" className="flex items-center gap-3">
<FaExternalLinkAlt className="h-5 w-5 group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform" />
View Live Demo
</a>
</Button>
)}
{project.repourl && (
<Button
asChild
variant="outline"
size="lg"
className="group bg-white/80 dark:bg-slate-800/80 backdrop-blur-sm border-slate-200 dark:border-slate-700 hover:bg-white dark:hover:bg-slate-800 hover:scale-105 hover:shadow-lg transition-all duration-300 px-8 py-3"
>
<a href={project.repourl} target="_blank" rel="noopener noreferrer" className="flex items-center gap-3">
<FaGitAlt className="h-5 w-5 group-hover:rotate-12 transition-transform" />
View Source Code
</a>
</Button>
)}
</div>
</div>
</div>
</div>
)}
</div>
</div>
);
} |